package com.jy.datapipeline.importserver.mapper;

import com.jy.datapipeline.importserver.entity.ImportRule;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

public interface ImportRuleMapper {
    int deleteByPrimaryKey(Long id);

    int insert(ImportRule record);

    int insertSelective(ImportRule record);

    ImportRule selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(ImportRule record);

    int updateByPrimaryKey(ImportRule record);

    List<ImportRule> selectByPage(@Param("pageNo") Long pageNo,
                                  @Param("pageSize") Long pageSize,
                                  @Param("ruleId") String ruleId,
                                  @Param("sourceDatabase") String sourceDatabase,
                                  @Param("targetDatabaseId") String targetDatabaseId);

    long selectTotalSize(@Param("ruleId") String ruleId,
                         @Param("sourceDatabase") String sourceDatabase,
                         @Param("targetDatabaseId") String targetDatabaseId);

    List<ImportRule> selectAllNames(String ruleName);

    ImportRule selectSqlldrInfoIdByRuleId(String ruleId);

    String selectRuleIdById(Long id);

    Integer selectResource(Long id);

    String selectSqlldrInfoId(Long id);

    int updateImportRuleUpdateTime(ImportRule importRule);

    Integer isExistsSameName(String ruleName);

    int batchInsert(@Param("importRuleList") List<ImportRule> importRuleList);

    int batchDelete(@Param("ids") Set<Long> ids);

    List<ImportRule> selectRuleIdsByIds(@Param("ids") Set<Long> ids);

    ImportRule selectOneByRuleName(String ruleName);
}